Skip to main content

Branch

Branch is created to connect dialogs. Depending on specified conditions the conversation flow is switched to the branched dialog. With branches, the dialogs can be clubbed according to the logic rather than writing the entire flow in one single dialog. Also, the dialogs can be reused by being connected to various dialogs.
The dialog can be branched to itself as well, called Self-loops. Basically, you can have a condition in which the dialog returns to the same dialog.

caution

An infinite loop is a workflow that will keep running forever as the terminating condition is never reached. An infinite loop can crash your Cognitbot or browser and freeze your computer. To avoid such incidents it is important to be aware of infinite loops so that they can be avoided - especially, in self-loops.

Branch Dialog Element can be used in various scenarios like:

  • User is given a Choice and each choice selection is mapped to a different dialog.
  • A dialog is part of the branch but it can be triggered separately as well.


Following is a screenshot of the Branch dialog element in its default state:

img alt

The fields available for Branch are given below:

  • Execution: Configuration to decide when to execute the respective Dialog Element. The options are as follows,
    • Enabled: The Dialog Element will be executed everytime the dialog is executed.
    • Disabled: The Dialog Element will never be executed even if the dialog is executed.
    • Condition: Depending on a certain condition, the Dialog Element is executed.
    info

    For a detailed explanation of Conditions, click here.

  • Conditions:
    • Value: The condition on which the branching would be done.
    • Target: The dialog to be branched to in case of the matching condition. Under the Target dropdown, all the dialogs from the particular skill will be available.
    info

    In case of multiple conditions, the conversation flow will be redirected to the target dialog that matches the first condition.

Parent dialogs will be connected to each of their corresponding branches with arrows as shown below.

img alt

The above image shows the Dialog Designer representation of a dialog "Demo Branch" with two branches - b1 and b2.